package cn.iocoder.yudao.module.system.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

//    @Bean
    public FilterRegistrationBean<TestFilter> registrationBean(){
        System.out.println("过滤器生成范围");
        FilterRegistrationBean<TestFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new TestFilter());
        //设置过滤器生成范围
        registrationBean.addUrlPatterns("/*");
        //过滤器名称
        registrationBean.setName("demoFilter");
        //设置优先级
        registrationBean.setOrder(1);
        return registrationBean;
    }
}